const { ordersModel } = require('./models/ordersModel');
module.exports.getOrders = async function(query) {
    const { pageSize, currentPage, _id, isDelete } = query;
    await ordersModel.updateOne({ _id }, { delete: isDelete });
    const data = await ordersModel.find({ delete: false }).populate({
        path: 'parkingsId',
        populate: {
            path: 'lessorsId'
        },
    }).populate('tenantsId').limit(pageSize - '0').skip((currentPage - 1) * pageSize);
    const total = data.length
    return { data, total }
}